/**
 * @file
 * @brief Windows specific header for fsnotify
 */

#ifndef _FSNOTIFY_DEF_H
#define _FSNOTIFY_DEF_H

#include <types.h>

#include <windows.h>
#include <glib.h>


struct watch_desc;
typedef struct watch_desc *watch_desc_t;

static inline void
watch_desc_init(watch_desc_t *wd)
{
    *wd = NULL;
}

static inline bool
watch_desc_is_valid(watch_desc_t wd)
{
    return wd != NULL;
}

struct fsnotify_desc {
    HANDLE hd;
    GHashTable *wd_map;
    GString *buf; /**< Path temporary buffer */
};

#define FSNOTIFY_DESC_STATIC_INITIALIZER {NULL, NULL, NULL}


/* Define here to avoid include <windows.h> */
//#define FILE_ACTION_ADDED                   0x00000001
//#define FILE_ACTION_REMOVED                 0x00000002
//#define FILE_ACTION_MODIFIED                0x00000003
//#define FILE_ACTION_RENAMED_OLD_NAME        0x00000004
//#define FILE_ACTION_RENAMED_NEW_NAME        0x00000005


#define FS_MODIFY           FILE_ACTION_MODIFIED
#define FS_MOVED_FROM       FILE_ACTION_RENAMED_OLD_NAME
#define FS_MOVED_TO         FILE_ACTION_RENAMED_NEW_NAME
#define FS_MOVE             0x00000006
#define FS_CREATE           FILE_ACTION_ADDED
#define FS_DELETE           FILE_ACTION_REMOVED

#define FS_ISDIR            0x00000010


#endif /* ! _FSNOTIFY_DEF_H */
